﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Xml;
using System.Data;
using System.Configuration;

using Gift.DAL;
using Gift.WebApp;


public partial class cn_UserControl_recommend_brand : System.Web.UI.UserControl
{
    // Fields
    BasePage thePage = new BasePage();
    protected string moduleSetXmlPath = "/cn/xml/module_set.xml";

    // Methods
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected StringBuilder RecommendBrandBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            XmlDocument document = new XmlDocument();
            document.Load(base.Server.MapPath(this.moduleSetXmlPath));
            XmlElement element = document.SelectSingleNode("set/recommend_brand") as XmlElement;
            if (!(element.GetAttribute("isShow") == "true"))
            {
                return builder;
            }
            DataTable brandByLanguage = BaseFactory.theBrand.GetBrandByCompanyId(thePage.CompanyId);
            builder.AppendLine("<div class=\"new_por\">");
            builder.AppendLine("<div class=\"title\">");
            builder.AppendLine("<p><span class=\"t_name_1\">" + element.GetAttribute("cn_title") + "</span><span class=\"t_name_2\">" + element.GetAttribute("en_title") + "</span></p>");
            builder.AppendLine("</div>");
            builder.AppendLine("<div class=\"info\">");
            builder.AppendLine("<div class=\"info_list_02\">");
            builder.AppendLine("<ul class=\"brand2\">");
            foreach (DataRow row in brandByLanguage.Rows)
            {
                builder.AppendLine(string.Concat(new object[] { "<li><a href=\"", row["brandUrl"], "\" target=\"_blank\"><img src=\"", row["brandLogo"], "\" alt=\"nike\" /></a></li>" }));
            }
            builder.AppendLine("</ul>");
            builder.AppendLine("<div class=\"clear\"></div>");
            builder.AppendLine("</div>");
            builder.AppendLine("</div>");
            builder.AppendLine("</div>");
        }
        catch
        {
        }
        return builder;
    }

}